package com.mpgame.common.constants;

import java.util.concurrent.TimeUnit;

public final class Constants {
    private Constants(){}

    public static final class CPorts{
        private CPorts(){}

        public static final int GATEWAY_TCP_PORT = 9000;
        public static final int VERIFY_GRPC_PORT = 9001;
        public static final int SOCIAL_GRPC_PORT = 9002;
        /** 游戏服务服务器gRPC端口 */
        public static final int GAME_GRPC_PORT = 9003;
        /** 战斗服务服务器gRPC端口 */
        public static final int BATTLE_GRPC_PORT = 9004;
    }

    public static final class CMySQL{
        private CMySQL(){}

        public static final int MYSQL_VERIFY_PORT = 3307;
        public static final int MYSQL_GAME_PORT = 3308;

        public static final String MYSQL_VERIFY_USER = "verify_user";
        public static final String MYSQL_VERIFY_PWD = "verify_pass123";

        public static final String MYSQL_GAME_USER = "game_user";
        public static final String MYSQL_GAME_PWD = "game_pass123";
    }

    public static final class CRedis{
        private CRedis(){}

        public static final int REDIS_PORT = 6380;

        public static final String REDIS_PWD = "redis123456";
    }

    public static final class CGrpc{
        private CGrpc(){}

        public static final long KEEP_ALIVE_TIME_SEC = 30;
        public static final long KEEP_ALIVE_TIMEOUT_SEC = 5;
        public static final boolean KEEP_ALIVE_WITHOUT_CALLS = true;

        public static final int MAX_INBOUND_MSG_BYTES = 4 * 1024 * 1024;
        public static final int MAX_INBOUND_METADATA_BYTES= 8 * 1024;

        public static final boolean ENABLE_RETRY = true;
		public static final int MAX_RETRY_ATTEMPTS = 3;
		public static final long DEFAULT_DEADLINE_SEC = 10;

		public static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
    }

    public static final class Services {
        private Services(){}

		public static final String VERIFY_SERVICE_NAME = "verify-service";
		public static final String CHAT_SERVICE_NAME   = "chat-service";
	}

	public static final class Messages {
        private Messages(){}

		public static final String ERR_SERVICE_UNAVAILABLE = "服务暂时不可用";
		public static final String ERR_PARSE_REQUEST       = "请求格式错误";
		public static final String ERR_INVOKE_FAILED       = "服务调用失败";
		public static final String ERR_TIMEOUT             = "服务调用超时";
	}
}
